// pages/home/searchpage/searchpage.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
       
       // houseTitleList : ["房产资源1","房产资源2","房产资源3","房产资源4"],
       // houseAddList : ["格园1斋357室","格园1斋257室","齐园1斋357室","诚园1斋357室"],
       // houseTypeList : ["一室一厅","一室一厅","一室一厅","一室一厅"],
       // houseAreaList : ["20㎡","20㎡","20㎡","20㎡"],
 
       search_str:"",
       datas:[{ 
       id:0,
       username:"",
       title:"房产资源1",
       kind:"",
       phone:"",
       lease:"",
       isjoint:"",
       requirement:"",
       funiture:"",
      
      
 
       rights:"",
       type:"一室一厅",
       orentation:"",
       floor:"",
       decoration:"",
       elevator:"",
       date:"",
       area:20,
       price:0,
       location:"格园1斋357室",
       date:"",
       picture:"/static/source/房1.png",
       other:""
      }
   ],
        
       token:"",
       message:"",
       username:""
       
     },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var searchstr=wx.getStorageSync('search_str')
        console.log(searchstr)
        var un = wx.getStorageSync('username')
        var tok = wx.getStorageSync('token')
        var that=this
        wx.request({
            url: 'http://172.23.144.125:8081/house/v1/info1/'+un+'/'+tok,
            method:"POST",
           
            data:{
                    info:{title:searchstr},
               title:searchstr
                
            },

            success:function(res){
                if(res.data.code==200){
                    that.setData({datas:res.data.datas})
                    console.log(res.data)
                    console.log(that.data.datas)
                }
                else{
                    wx.showToast({
                      title: res.data.message,
                      duration: 2000,
                      icon: "error",

                    })
                }
            },
            fail:function(res)
            {
                wx.showToast({
                  title: '请求超时',
                  duration:2000,
                  icon:"error"
                })
            }
    
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})